<template>
  <Mapbox :mapOnLoadCB="mapOnLoadCB"></Mapbox>
</template>

<script>
import {ref} from "vue"
import Mapbox from "@/components/common/Mapbox.component.vue"

export default {
  name: "MapNavigation.component",
  components: {Mapbox},
  setup() {

    let mapStore = ref({});
    let mapOnLoadCB = (map) => {
      mapStore.value = map;

      // 使用 mapbox-gl-directions 插件来展示从Mapbox Directions API获得的结果。点击地图来添加起点与终点。
      map.addControl(new MapboxDirections({
        accessToken: mapboxgl.accessToken
      }), 'top-left');
    };

    return {
      mapOnLoadCB
    }
  }
}
</script>

<style scoped>

</style>